//--------------- 用户管理处理函数 ----------

// 引入数据库连接
const conn = require('../data');

// 登陆
module.exports.login = (req, res) => {
    res.render('./user/login');
};
// 注册
module.exports.registry = (req, res) => {
    res.render('./user/registry');
};

// 注册添加用户
module.exports.addUser = (req, res)=>{
    console.log(req.body);
    let params = [req.body.email, req.body.tel, req.body.login_name, req.body.nike_name, req.body.password];
    conn.query('insert into blog_users values(?,?,?,?,?)', params, (error, results) =>{
        if(error){
            return console.log(error);
        }else{
            res.json({
                code: '1001',
                message: '用户添加成功'
            })
        }
        
    })
}